import router from '@ohos.router';
import storage from '@system.storage';

export default {
    data: {
        title: "Hello HarmonyOS",
        isHarmonyOS: true,
        phone: '',
        mediate: '',  // 捏合
        mediate_grade: '',  // 手指伸展
        finger: '',  // 
        finger_grade: '',
        tremble: '',
        tremble_grade: '',
        myoelectricity: '',
        myoelectricity_grade: '',
        "setArray": [
            {"dir":"/common/images/mine_message.svg"},
            {"value": "意见反馈"},
            {"dir":"/common/images/mine_set.png"},
            {"value": "系统设置"},
            {"dir":"/common/images/mine_quit.png"},
            {"value": "退出登录"},
            {"dir":"/common/images/mine_about.svg"},
            {"value": "关于"},
        ],

        "dirArray": [
            {"dir":"/common/images/mine_message.svg"},
            {"dir":"/common/images/mine_set.png"},
            {"dir":"/common/images/mine_quit.png"},
            {"dir":"/common/images/mine_about.svg"},
        ],
    },

    switchTitle() {
        let that = this;
        that.title = that.isHarmonyOS ? "Hello World" : "Hello HarmonyOS";
        that.isHarmonyOS = !that.isHarmonyOS;
    },

    onInit(){
        // 从缓存取用户信息，自动登录
        storage.get({
            key: 'id',
            success: data => {
                if(data){
                    this.phone = data
                }
            },
        });

        // 昵称
        storage.get({
            key: 'name',
            success: data => {
                if(data){
                    this.phone = data
                }
            },
        });

        // 从缓存取用户信息，自动登录
        storage.get({
            key: 'id',
            success: data => {
                if(data){
                    this.phone = data
                }
            },
        });

    },

    quit(){
        router.push ({
            url:'pages/login/login', // 指定要跳转的页面
        })
    }
}